Fix NpmPublishTask workingDir scope #16
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📖 Description
Fix
NpmPublishTaskworkingDir scope.When using the generated task
publishJsNpmPublicationToNexusfor a custom repository, the publication to Sonatype was reporting a success (HTTP PUT 200) but no artifact was ever uploaded to the expected repository.Custom Repository config:
Outputs of the command sent to Node failing to publish was as follow:
When run manually using a terminal while being in
pwd->/Users/boubalou/dev/xxx/common/build/publications/npm, it was getting published succesfully.🤓 Solution
Turns out that
npm publishmust be executed at the root of the source package to upload flawlessly. It is still unknown to me if this is an issue with Nexus itself, or because we use a custom registry, but it is what it is.The fix is quite easy, make sure to use the current package directory as the
workingDirwhen invoking Node commands for publishing.